package com.geek.base.ch02.work;

import java.util.Arrays;

/*
 *@Date 2025/11/8
 *@Author wangpeng
 *@Description TODO
 */
public class Test {
    public static void main(String[] args) {
        char[] chs = {'j','h','o','b','c','e'};
        System.out.println(chs.toString());      //[C@1b6d3586
        System.out.println(Arrays.toString(chs));

        //public static void sort(int[] a)  排序
        Arrays.sort(chs);
        System.out.println("排序后："+Arrays.toString(chs));

        //public static int binarySearch(int[] a, int key)  二分搜索法，前提必须是排序好的数组
        int index1 = Arrays.binarySearch(chs, 'o');
        System.out.println("o元素的下标位置："+index1);
        int index2 = Arrays.binarySearch(chs, 'k');
        System.out.println("k元素的下标位置："+index2);
    }
}
